package com.sisyphus.tron.persistence;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

@Database(entities = {AccountEntity.class}, version = 1)
public abstract class TronCliDatabase extends RoomDatabase {

    private final static String DATA_BASE_NAME = "sisyphus_tron_cli.db";

    private static final Object sLock = new Object();

    private static TronCliDatabase INSTANCE;

    public static TronCliDatabase getInstance(Context context) {
        if (INSTANCE == null) {
            synchronized (sLock) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(
                            context.getApplicationContext(),
                            TronCliDatabase.class, DATA_BASE_NAME
                    ).build();
                }
            }
        }

        return INSTANCE;
    }


    public abstract TronDao tronDao();

}
